package com.zkadmin.helper;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;

import com.zkadmin.entity.SysSetting;
import com.zkadmin.service.SysSettingService;

public class ZkAdminInit implements ApplicationListener<ApplicationEvent> {
	private static boolean isInit = false;

	private static SysSetting setting;

	@Autowired
	private SysSettingService sysSettingService;

	@Override
	public void onApplicationEvent(ApplicationEvent applicationEvent) {
		if (!isInit) {
			setting = sysSettingService.getSysSetting();
			isInit = true;
		}
	}

	public static SysSetting getSetting() {
		return setting;
	}

	public static void setSetting(SysSetting setting) {
		ZkAdminInit.setting = setting;
	}

}
